package oop;

import java.awt.*;

import javax.swing.*;
import javax.swing.border.TitledBorder;

public class OrderFind extends JFrame{
        
        private static final long serialVersionUID = 1L;
    private Font f;
    private JPanel p;
    private JLabel labelHeader,labelSearch,labelDate,labelOrder;
    private JList<String> listOrder;
    private JScrollPane listScroll;
    private JButton buttonOk,buttonCancel;
    
    public OrderFind(){
        super("OrderFind");
        setLayout(null);
        p = new JPanel(null);
        p.setBorder(BorderFactory.createTitledBorder(null, "Order Find", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION,new Font("Segoe UI",Font.PLAIN,14)));
        setComponent();
        p.setBounds(5, 5, 392, 229);
        add(p);
        setBounds(455,160,418,276);
    }
        
    public void setComponent(){
        //setFont
        f = new Font("Tahoma",Font.PLAIN,12);
        
        //create component
        labelHeader = new JLabel("ORDER FIND");         
        labelSearch = new JLabel("ค้นหารายการสินค้า..");               
        labelDate = new JLabel("วันเวลา :");               
        labelOrder = new JLabel("รายการสินค้า");                                
        buttonOk = new JButton("ตกลง");             
        buttonCancel = new JButton("ยกเลิก");  
        
        String OrMenu[] = {"a","b","c","d","e","f"};
        listOrder = new JList<String>(OrMenu);
        listOrder.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listScroll = new JScrollPane(listOrder);
        
        //setFont
        labelHeader.setFont(new Font("Segoe UI",Font.BOLD,18));
        labelSearch.setFont(new Font("Tahoma",Font.PLAIN,11));
        labelDate.setFont(f);
        labelOrder.setFont(f);  
        buttonOk.setFont(new Font("Tahoma",Font.PLAIN,11));
        buttonCancel.setFont(new Font("Tahoma",Font.PLAIN,11));
        listOrder.setFont(f);
        
        //setBounds
        labelHeader.setBounds(20, 25, 150, 20);
        labelSearch.setBounds(25, 50, 150, 20);
        labelDate.setBounds(70, 80, 90, 20);
        labelOrder.setBounds(50, 115, 90, 20);
        listScroll.setBounds(120, 120, 170, 100);
        buttonOk.setBounds(300, 80, 85,25);
        buttonCancel.setBounds(300, 110, 85,25);
        
        //setIcon
        buttonOk.setIcon(new ImageIcon("D:\\Project\\src\\pic\\ok.png"));
        buttonCancel.setIcon(new ImageIcon("D:\\Project\\src\\pic\\Delete.png"));
        
        //add
        p.add(labelHeader);
        p.add(labelSearch);
        p.add(labelDate);
        p.add(labelOrder);
        p.add(listScroll);
        p.add(buttonOk);
        p.add(buttonCancel);
        
        }
    }